<template>
  <div class="child1">
    <h1>Child1组件</h1>
    <button @click="sendData">发送数据</button>
  </div>
</template>

<script>
import events from "../utils/events";
export default {
  methods: {
    sendData() {
      // 触发自定义事件
      events.$emit("message", "hello child2");
    }
  },
};
</script>

<style>
.child1 {
  background: lightgreen;
  padding: 10px;
}
</style>